package com.usian.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usian.pojo.Auth;
import com.usian.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AuthMapper extends BaseMapper<Auth> {

    @Select("select * from t_auth u where u.id in(\n" +
            "select h.auth_id from t_role_auth h where h.role_id in(\n" +
            "select t.id from t_role t where t.id in( \n" +
            "select e.role_id from t_user_role e where e.user_id = #{userId} )))")
    public List<Auth> findAuthByUserId(@Param("userId") Integer userId);
}
